import { dateFormat } from '@/util/date';
export const startDate = dateFormat(new Date(), 'yyyy-MM-') + '01';
let now = new Date();
now.setDate(now.getDate() + 1);
export const endDate = dateFormat(now, 'yyyy-MM-dd');
export const tableOption = {
  border: true,
  index: true,
  indexLabel: '序号',
  stripe: true,
  menuAlign: 'center',
  align: 'center',
  dialogWidth: '70%',
  addBtn: false,
  viewBtn: true,
  editBtn: false,
  delBtn: false,
  labelWidth: 140,
  selection: true,
  editTitle: '申 请',
  updateBtnText: '确 认',
  selectable: row => {
     return row.checkStatus== '0' || row.checkStatus== '1';
  },
  column: [{
    label: '标识',
    prop: 'id',
    hide: true,
    display: false
  }, {
    label: '单号',
    prop: 'numbers',
    display: false,
    search: true
  },{
    label: '计划类型',
    prop: 'planType',
    type: 'select',
    dicData: [{
      label: '清洗计划',
      value: '1'
    }, {
      label: '生产计划',
      value: '2'
    }],
    display: false
  }, {
    label: '票种',
    prop: 'ticketType',
    type: 'select',
    search: true,
    dicUrl: '/support/swpmticketcardtype/dict',
    props: {
      label: 'mainName',
      value: 'mainEnName'
    },
    cascaderItem: ["ticketName"],
    rules: [{
      required: true,
      message: '请选择票种',
      trigger: 'blur'
    }],
    display: false
  }, {
    label: '车票名称',
    prop: 'ticketName',
    type: 'select',
    dicUrl: '/support/swpmticketcardtypeparam/dictAll/{{key}}',
    dicFlag: false,
    component: 'ticket-name-select',
    props: {
      label: 'subName',
      value: 'subEnName'
    },
    params: {
      ticketAmountKey: 'ticketPrice',
      ticketCountKey: 'ticketTimes'
    },
    search: true,
    rules: [{
      required: true,
      message: '请选择车票名称',
      trigger: 'blur'
    }],
    display: false
  }, {
    label: '票价',
    prop: 'ticketPrice',
    type: 'number',
    precision: 2,
    disabled: true,
    rules: [{
      required: true,
      message: '请输入票价',
      trigger: 'blur'
    }],
    display: false
  }, {
    label: '车票次数',
    prop: 'ticketTimes',
    type: 'number',
    disabled: true,
    rules: [{
      required: true,
      message: '请输入车票次数',
      trigger: 'blur'
    }],
    display: false
  }, {
    label: '车票有效期',
    prop: 'activeTime',
    type: 'input',
    // rules: [{
    //   required: true,
    //   message: '请输入车票有效期',
    //   trigger: 'blur'
    // }],
    display: false
  }, {
    label: '车票最晚使用时间',
    prop: 'latestStartTime',
    type: 'date',
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd HH:mm:ss',
    // rules: [{
    //   required: true,
    //   message: '请选择车票最晚使用时间',
    //   trigger: 'blur'
    // }],
    display: false
  }, {
    label: '张数',
    prop: 'ticketNumber',
    type: 'number',
    rules: [{
      required: true,
      message: '请输入车票张数',
      trigger: 'blur'
    }],
    display: false
  }, {
    label: '起号/止号',
    prop: 'startEndNo',
    // rules: [{
    //   required: true,
    //   message: '请输入起号/止号',
    //   trigger: 'blur'
    // }],
    display: false
  }, {
    label: '车票用途',
    prop: 'ticketPurpose',
    // rules: [{
    //   required: true,
    //   message: '请输入车票用途',
    //   trigger: 'blur'
    // }],
    display: false,
    hide: true
  }, {
    label: '计划开始时间',
    prop: 'planStartTime',
    type: 'date',
    search: true,
    searchValue: startDate, 
    searchLabelWidth: 100,
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    display: false
  }, {
    label: '计划结束时间',
    prop: 'planEndTime',
    type: 'date',
    search: true,
    searchValue: endDate, 
    searchLabelWidth: 100,
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    display: false
  }, {
    label: '现计划张数',
    prop: 'ticketNumberNow',
    rules: [{
      required: true,
      message: '请输入现计划车票张数',
      trigger: 'blur'
    }],
    display: false
  }, {
    label: '现计划开始时间',
    prop: 'planStartTimeNow',
    type: 'date',
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd HH:mm:ss',
    display: false
  }, {
    label: '现计划结束时间',
    prop: 'planEndTimeNow',
    type: 'date',
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd HH:mm:ss',
    display: false
  }, {
    label: '审批状态',
    prop: 'checkStatus',
    type: 'select',
    dicUrl: '/admin/dict/type/check_status',
    search: true,
    display: false
  }, {
    label: '审核人',
    prop: 'checkPersonId',
    hide: true,
    display: false
  }, {
    label: '审核时间',
    prop: 'checkTime',
    hide: true,
    display: false
  }, {
    label: '备注',
    prop: 'remark',
    type: 'textarea',
    span: 24,
    maxRows: 6,
    minRows: 4,
    display: false
  }, {
    label: '创建人ID',
    prop: 'creatorId',
    hide: true,
    display: false
  }, {
    label: '创建人名称',
    prop: 'creatorName',
    hide: true,
    display: false
  }, {
    label: '创建时间',
    prop: 'createtime',
    hide: true,
    display: false
  }],
  group: [{
    lalbel: '申请',
    column: [{
      label: '申请原因',
      prop: 'applyReason',
      disalbed: false,
      rules: [{
        required: true,
        message: '请输入申请原因',
        trigger: 'blur'
      }]
    }]
  }, {
    label: '临时计划信息',
    column: [{
      label: '单号',
      prop: 'numbers',
      disabled: true
    },{
      label: '计划类型',
      prop: 'planType',
      type: 'select',
      dicData: [{
        label: '清洗计划',
        value: '1'
      }, {
        label: '生产计划',
        value: '2'
      }],
      disabled: true
    },{
      label: '票种',
      prop: 'ticketType',
      type: 'select',
      dicUrl: '/support/swpmticketcardtype/dict',
      props: {
        label: 'mainName',
        value: 'mainEnName'
      },
      cascaderItem: ["ticketName"],
      rules: [{
        required: true,
        message: '请选择票种',
        trigger: 'blur'
      }],
      disabled: true
    }, {
      label: '车票名称',
      prop: 'ticketName',
      type: 'select',
      dicUrl: '/support/swpmticketcardtypeparam/dictAll/{{key}}',
      dicFlag: false,
      component: 'ticket-name-select',
      params: {
        ticketAmountKey: 'ticketPrice',
        ticketCountKey: 'ticketTimes'
      },
      rules: [{
        required: true,
        message: '请选择车票名称',
        trigger: 'blur'
      }],
      disabled: true
    }, {
      label: '票价',
      prop: 'ticketPrice',
      type: 'number',
      precision: 2,
      disabled: true
    }, {
      label: '车票次数',
      prop: 'ticketTimes',
      type: 'number',
      disabled: true
    }, {
      label: '车票有效期',
      prop: 'activeTime',
      type: 'input',
      //row: true,
      // rules: [{
      //   required: true,
      //   message: '请输入车票有效期',
      //   trigger: 'blur'
      // }],
      disabled: false
    }, {
      label: '车票最晚使用时间',
      prop: 'latestStartTime',
      type: 'date',
      format: 'yyyy-MM-dd',
      valueFormat: 'yyyy-MM-dd HH:mm:ss',
      // rules: [{
      //   required: true,
      //   message: '请选择车票最晚使用时间',
      //   trigger: 'blur'
      // }],
      disabled: false
    }, {
      label: '张数',
      prop: 'ticketNumber',
      type: 'number',
      rules: [{
        required: true,
        message: '请输入车票张数',
        trigger: 'blur'
      }],
      disabled: true
    },{
      label: '车票编码员',
      prop: 'ticketCoder',
      disabled: true
    },{
      label: '车票编码员工号',
      prop: 'ticketCoderCode',
      disabled: true
    }, {
      label: '起号/止号',
      prop: 'startEndNo',
      // rules: [{
      //   required: true,
      //   message: '请输入起号/止号',
      //   trigger: 'blur'
      // }],
      disabled: true
    }, {
      label: '车票用途',
      prop: 'ticketPurpose',
      // rules: [{
      //   required: true,
      //   message: '请输入车票用途',
      //   trigger: 'blur'
      // }],
      disabled: true,
      hide: true,
      display: false
    }, {
      label: '计划开始时间',
      prop: 'planStartTime',
      type: 'date',
      format: 'yyyy-MM-dd',
      valueFormat: 'yyyy-MM-dd HH:mm:ss',
      disabled: true
    }, {
      label: '计划结束时间',
      prop: 'planEndTime',
      type: 'date',
      format: 'yyyy-MM-dd',
      valueFormat: 'yyyy-MM-dd HH:mm:ss',
      disabled: true
    }, {
      label: '备注',
      prop: 'remark',
      type: 'textarea',
      span: 24,
      maxRows: 6,
      minRows: 4,
      disabled: true
    }]
  }, {
    label: '临时计划修改',
    display: true,
    column: [{
      label: '现计划张数',
      prop: 'ticketNumberNow',
      type: 'number',
      disabled: false,
      rules: [{
        required: true,
        message: '请输入现计划车票张数',
        trigger: 'blur'
      }]
    }, {
      label: '现计划开始时间',
      prop: 'planStartTimeNow',
      type: 'date',
      format: 'yyyy-MM-dd',
      valueFormat: 'yyyy-MM-dd HH:mm:ss',
      disabled: false,
      rules: [{
        required: true,
        message: '请选择现计划开始时间',
        trigger: 'blur'
      }]
    }, {
      label: '现计划结束时间',
      prop: 'planEndTimeNow',
      type: 'date',
      format: 'yyyy-MM-dd',
      valueFormat: 'yyyy-MM-dd HH:mm:ss',
      disabled: false,
      rules: [{
        required: true,
        message: '请选择现计划结束时间',
        trigger: 'blur'
      }]
    }, {
      label: '审批状态',
      prop: 'checkStatus',
      type: 'select',
      dicUrl: '/admin/dict/type/check_status',
      span: 24,
      addDisplay: false,
      editDisplay: false
    }, {
      label: '审批建议',
      prop: 'checkReason',
      type: 'textarea',
      editDisplay: false,
      span: 24,
      maxRows: 6,
      minRows: 4
    }]
  }]
};
